package org.budo.beetl.resource.localfile;

import java.io.File;
import java.io.InputStream;
import java.io.Reader;

import org.beetl.core.ResourceLoader;
import org.beetl.core.resource.FileResource;
import org.budo.beetl.resource.BeetlResource;
import org.budo.support.lang.util.IoUtil;

/**
 * @author limingwei
 */
public class BudoLocalFileBeetlResource extends FileResource implements BeetlResource {
    private File _file;

    public BudoLocalFileBeetlResource(File file, String id, ResourceLoader loader) {
        super(file, id, loader);
        this._file = file;
    }

    @Override
    public Reader openReader() {
        return IoUtil.toReader(this._file);
    }

    @Override
    public InputStream inputStream() {
        return IoUtil.fileInputStream(this._file);
    }
}